const state = {
  settingVisible: false,
  broadcast: '欢迎光临',
  receiptPrinter: '', // 小票打印机
  invoicePrinter: '', // 发票打印机
  mpPayReceiptOn: false, // 打印点付结算小票
  mpRechargeReceiptOn: false, // 打印线上充值小票
  pcRechargeReceiptOn: false, // 打印后台充值小票
  localPayReceiptOn: true, // 打印本机结算小票
  onlineReceiptOn: false, // 线上商品小票打印
  gunAmountVoiceLimit: [], // 不播报语音的油枪列表
  saleFuelRecordVisible: false, // 显示加油结算记录
  customerDiscountList: [], // 客户类型优惠设置列表
  invoicePrintTarget: '', // 发票打印对象（自助结算机、不打印、其他发票）
  voiceType: '', // 语音类型
  voiceRole: '', // 语音角色
  voiceSpeed: 1 // 语音速度
}

const getters = {
  settingVisible: state => state.settingVisible,
  broadcast: state => state.broadcast,
  receiptPrinter: state => state.receiptPrinter,
  invoicePrinter: state => state.invoicePrinter,
  mpPayReceiptOn: state => state.mpPayReceiptOn,
  mpRechargeReceiptOn: state => state.mpRechargeReceiptOn,
  pcRechargeReceiptOn: state => state.pcRechargeReceiptOn,
  localPayReceiptOn: state => state.localPayReceiptOn,
  gunAmountVoiceLimit: state => state.gunAmountVoiceLimit,
  saleFuelRecordVisible: state => state.saleFuelRecordVisible,
  onlineReceiptOn: state => state.onlineReceiptOn,
  customerDiscountList: state => state.customerDiscountList,
  invoicePrintTarget: state => state.invoicePrintTarget,
  voiceType: state => state.voiceType,
  voiceRole: state => state.voiceRole,
  voiceSpeed: state => state.voiceSpeed
}

const mutations = {
  SHOW_SETTING (state) {
    state.settingVisible = true
  },
  HIDE_SETTING (state) {
    state.settingVisible = false
  },
  SET_BROADCAST (state, payload) {
    state.broadcast = payload
  },
  setReceiptPrinter (state, data) {
    state.receiptPrinter = data
  },
  setInvoicePrinter (state, data) {
    state.invoicePrinter = data
  },
  setMpPayReceiptOn (state, data) {
    state.mpPayReceiptOn = data
  },
  setMpRechargeReceiptOn (state, data) {
    state.mpRechargeReceiptOn = data
  },
  setPcRechargeReceiptOn (state, data) {
    state.pcRechargeReceiptOn = data
  },
  setLocalPayReceiptOn (state, data) {
    state.localPayReceiptOn = data
  },
  setGunAmountVoiceLimit (state, data) {
    state.gunAmountVoiceLimit = data
  },
  setSaleFuelRecordVisible (state, data) {
    state.saleFuelRecordVisible = data
  },
  setOnlineReceiptOn (state, data) {
    state.onlineReceiptOn = data
  },
  setCustomerDiscountList (state, data) {
    state.customerDiscountList = data
  },
  setInvoicePrintTarget (state, data) {
    state.invoicePrintTarget = data
  },
  setVoiceType (state, data) {
    state.voiceType = data
  },
  setVoiceRole (state, data) {
    state.voiceRole = data
  },
  setVoiceSpeed (state, data) {
    state.voiceSpeed = data
  }
}

const actions = {
  showSetting ({commit}) {
    commit('SHOW_SETTING')
  },
  hideSetting ({commit}) {
    commit('HIDE_SETTING')
  },
  setBroadcast ({commit}, payload) {
    commit('SET_BROADCAST', payload)
  },
  setReceiptPrinter ({commit}, payload) {
    commit('setReceiptPrinter', payload)
  },
  setInvoicePrinter ({commit}, payload) {
    commit('setInvoicePrinter', payload)
  },
  setMpPayReceiptOn ({commit}, payload) {
    commit('setMpPayReceiptOn', payload)
  },
  setMpRechargeReceiptOn ({commit}, payload) {
    commit('setMpRechargeReceiptOn', payload)
  },
  setPcRechargeReceiptOn ({commit}, payload) {
    commit('setPcRechargeReceiptOn', payload)
  },
  setLocalPayReceiptOn ({commit}, payload) {
    commit('setLocalPayReceiptOn', payload)
  },
  setGunAmountVoiceLimit ({commit}, payload) {
    commit('setGunAmountVoiceLimit', payload)
  },
  setSaleFuelRecordVisible ({commit}, payload) {
    commit('setSaleFuelRecordVisible', payload)
  },
  setOnlineReceiptOn ({commit}, payload) {
    commit('setOnlineReceiptOn', payload)
  },
  setCustomerDiscountList ({commit}, payload) {
    commit('setCustomerDiscountList', payload)
  },
  setInvoicePrintTarget ({commit}, payload) {
    commit('setInvoicePrintTarget', payload)
  },
  setVoiceType ({commit}, payload) {
    commit('setVoiceType', payload)
  },
  setVoiceRole ({commit}, payload) {
    commit('setVoiceRole', payload)
  },
  setVoiceSpeed ({commit}, payload) {
    commit('setVoiceSpeed', payload)
  }
}

export default {
  state,
  getters,
  mutations,
  actions
}
